﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using TestByWire.Test.Fakes;

namespace TestByWire.Test
{
	[TestClass]
	public class WhenInterfaceTest : TestTarget<IComputer, Computer>
	{
		[TestMethod]
		public void CallingPropertyMustBeInterface()
		{
			var property = When.GetType().GetProperty("Calling");

			Assert.IsTrue(property.PropertyType.IsInterface);
		}

		[TestMethod]
		public void MustBeAbleToInvokeThroughInterface()
		{
			Given.That<ICalculator>(c => c.Add(0, 0)).Returns(4);

			int result = When.Calling.Calculator.Add(2, 2);

			Assert.AreEqual(4, result);
		}
	}
}
